package com.example.normaldemo.recycleView;

import android.view.View;
import android.widget.AdapterView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.normaldemo.R;

import java.util.ArrayList;
import java.util.List;

public class NewsFragment extends BaseRecycleFragment<RefreshAdapter> implements AdapterView.OnItemClickListener {

    @Override
    public void initData() {
        mItemDatas = getRefreshData();
        mAdapter = new RefreshAdapter(mItemDatas, R.layout.item_recycleview, this);
        mManager = new LinearLayoutManager(mContext);
    }

    @Override
    public List getRefreshData() {
        List<String> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            list.add("第" + i + "条数据");
        }
        return list;
    }

    @Override
    public List getLoadMoreData() {
        List<String> list = new ArrayList<>();
        for (int i = mAdapter.getItemCount(); i < mAdapter.getItemCount() + 10; i++) {
            list.add("第" + i + "条数据");
        }
        return list;
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
        System.out.println("daffie");
        System.out.println("1");
        System.out.println("2");
        System.out.println("3");
        System.out.println("4");
        System.out.println("5");
        System.out.println("6");
        System.out.println("6");
        System.out.println("6");
        System.out.println("6");
    }
}
